package com.tesis_2.UI;


import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;

import com.example.tesis_2.R;
import com.tesis_2.Utils.UTRestaurantsCategoryImageAdapter;


public class UIRestaurantsCategory extends Fragment {
	GridView gridView;
	 
	
	
	public static final String ARG_SECTION_NUMBER = "section_number";
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
             Bundle savedInstanceState) {
	// Inflate the layout for this fragment
	//View fragmentView	= inflater.inflate(R.layout.activity_restaurants_category, container, false);
	View V = inflater.inflate(R.layout.activity_restaurants_category, container, false);
	
	
	gridView = (GridView) V.findViewById(R.id.gvBase_restaurant_category);
	//ArrayAdapter<String> adapter = new ArrayAdapter<String>(this.getActivity().getApplicationContext(),
		//	android.R.layout.simple_list_item_1, numbers);
	GridView gridView=(GridView)V.findViewById(R.id.gvBase_restaurant_category);
	gridView.setAdapter(new UTRestaurantsCategoryImageAdapter(this.getActivity().getApplicationContext()));
	//gridView.setAdapter(adapter);
	
	gridView.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> parent, View v,
				int position, long id) {
				
				Intent intent = new Intent(getActivity().getApplicationContext(), UIRestaurantDetail.class);
				intent.putExtra("nRest", position);
				startActivity(intent);
			}
		});
	
	
	return  V;
	
	}

}
